package itdep.common.context.spring;

import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.acls.model.Permission;

/**
 * @author Ivan Khalopik
 * @version $Revision: 4 $ $Date: 2010-06-10 13:13:16 +0000 (Thu, 10 Jun 2010) $
 */
public class PermissionAttribute implements ConfigAttribute {
	private final Permission permission;

	public PermissionAttribute(final Permission permission) {
		this.permission = permission;
	}

//	public PermissionAttribute(final String attr) {
//		permission = BasePermission.buildFromName(attr);
//	}

	public Permission getPermission() {
		return permission;
	}

	public String getAttribute() {
		return permission.getPattern();
	}

	@Override
	public String toString() {
		return "Permission: " + permission;
	}
}
